﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Jzy.BLL.Forum;
using Jzy.Model.Forum;
using Jzy.Core.Utility;
using System.Text;
using Jzy.BLL.Member;
using Jzy.Model.Member;

namespace Jzy.Web.Forum.Board
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class GetMember : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //context.Response.Write(context.Request.Form["LoginNames"]);

            List<string> loginNames = StrUtil.SplitToStr(context.Request.Form["LoginNames"]);
            SiteMemberBO member = new SiteMemberBO();

            string notExistUsers ;
            List<SiteMemberInfo> list = member.GetList(loginNames, out notExistUsers);

            StringBuilder sbMembers = new StringBuilder();
            sbMembers.Append("{Members:[");
            foreach (SiteMemberInfo info in list)
            {
                sbMembers.Append("{ID:'" + info.ID + "',LoginName:'" + info.LoginName + "'},");
            }

            string str1 = sbMembers.ToString().Trim(',') + "],";
            str1 += "NotExistMember:'" + notExistUsers + "'}";

            context.Response.Write(str1);
            

            //context.Response.Write("Hello World");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
